<!DOCTYPE html>  
<html lang="en">  
<head>  
    <meta charset="UTF-8">  
    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    <title>高精度加法计算器</title>  
    <style>  
        body {  
            font-family: Arial, sans-serif;  
            margin: 20px;  
        }  
        .container {  
            max-width: 300px;  
            margin: 0 auto;  
            text-align: center;  
        }  
        .input-group {  
            margin-bottom: 15px;  
        }  
        .input-group input {  
            width: 100%;  
            padding: 8px;  
            box-sizing: border-box;  
        }  
        .input-group label {  
            display: block;  
            margin-bottom: 5px;  
        }  
        .result {  
            font-size: 1.5em;  
            margin-top: 20px;  
        }  
    </style>  
</head>  
<body>  
    <div class="container">  
        <h1>高精度加法计算器</h1>  
        <div class="input-group">  
            <label for="num1">数字 1:</label>  
            <input type="text" id="num1" placeholder="输入第一个数字">  
        </div>  
        <div class="input-group">  
            <label for="num2">数字 2:</label>  
            <input type="text" id="num2" placeholder="输入第二个数字">  
        </div>  
        <button onclick="calculateSum()">计算</button>  
        <div class="result" id="result"></div>  
    </div>  
  
    <script>  
        function accAdd(arg1, arg2) {  
            var r1, r2, m;  
            try {  
                r1 = arg1.toString().split('.')[1].length;  
            } catch (e) {  
                r1 = 0;  
            }  
            try {  
                r2 = arg2.toString().split('.')[1].length;  
            } catch (e) {  
                r2 = 0;  
            }  
            m = Math.pow(10, Math.max(r1, r2));  
            return (Number(arg1 * m) + Number(arg2 * m)) / m;  
        }  
  
        function calculateSum() {  
            var num1 = parseFloat(document.getElementById('num1').value);  
            var num2 = parseFloat(document.getElementById('num2').value);  
            var result = accAdd(num1, num2);  
            document.getElementById('result').innerText = '结果: ' + result;  
        }  
    </script>  
</body>  
</html>